<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Lista de Contatos</title>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css"/>
    <script type="text/javascript" src="<?php echo base_url() ?>js/jquery-1.6.js"></script>
    <script type="text/javascript" src="<?php echo base_url() ?>js/jquery-ui-1.8.13.custom.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/core.js"></script>
  </head>
  <body>
    <?php
    include ("includes/nav_bar.php");
    ?>
    <div id="main-content">
      <div id="conteudo" style="width: 95%;">
        <h1>Contatos Recebidos</h1>
        <?php if (isset($view_msg))
          echo $view_msg; ?>
        <p><a href="<?php echo base_url(); ?>logs/logContato">Gerar log de contatos</a></p>
        <table class="jtable contatos-recebidos">
          <thead>
            <tr>
              <th>Nome</th>
              <th>Email</th>
              <th>Data</th>
              <th>Tipo</th>
              <th style="width: 48px; text-align: center;">Ações</th>
            </tr>
          </thead>
          <?php if (isset($view_contatos)): ?>
            <tbody>
              <?php foreach ($view_contatos as $contato): ?>
                <tr>
                  <td><?php echo $contato->char_nome; ?></td>
                  <td><?php echo $contato->char_email; ?></td>
                  <td><?php echo $contato->date_dataContato; ?></td>
                  <td style="text-align: justify;"><?php echo nl2br($contato->char_tipo); ?></td>
                  <td style="text-align: center;">
                    <?php if ($contato->int_lido == 1): ?>
                       <button class="jbutton ler-contato-aberto" onclick="parent.location='<?php echo base_url() . "pagina/lerContato/id/" . $contato->pk_int_idContato; ?>'" >Ler Mensagem</button>
                    <?php else: ?>
                      <button class="jbutton ler-contato-fechado" onclick="parent.location='<?php echo base_url() . "pagina/lerContato/id/" . $contato->pk_int_idContato; ?>'" >Ler Mensagem</button>
                    <?php endif; ?>
                    <button class="jbutton apagar-contato" onclick="parent.location='<?php echo base_url() . "pagina/apagarContato/id/" . $contato->pk_int_idContato; ?>'">Apagar Mensagem</button>
                  </td>
                </tr>
              <?php endforeach; ?>
            </tbody>
          <?php endif; ?>
        </table>
      </div>
    </div>
  </body>
</html>